package cn.tqfeiyang.smartadmin.business.organization.mapper;

import cn.tqfeiyang.smartadmin.business.organization.entity.DepartmentEntity;
import cn.tqfeiyang.smartadmin.business.organization.request.DepartmentQueryDTO;
import cn.tqfeiyang.smartadmin.business.organization.response.DepartmentDetailVO;
import cn.tqfeiyang.smartadmin.business.organization.response.DepartmentQueryVO;
import cn.tqfeiyang.smartadmin.business.organization.entity.EmployeeEntity;
import cn.tqfeiyang.smartadmin.business.organization.response.EmployeeQueryVO;
import cn.tqfeiyang.smartadmin.commons.mybatis.MPBaseMapper;
import cn.tqfeiyang.smartadmin.commons.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 部门映射接口
 *
 * @author tqfeiyang
 * @since 2024-10-18
 */
@Mapper
public interface DepartmentMapper extends MPBaseMapper<DepartmentEntity> {

    /**
     * 查询部门列表
     *
     * @param dto 请求数据
     * @return 部门列表
     */
    List<DepartmentQueryVO> queryDepartments(@Param(Constants.DTO) DepartmentQueryDTO dto);

    /**
     * 查询部门详情
     *
     * @param departmentId 部门id
     * @return 部门详情
     */
    DepartmentDetailVO readDepartment(Long departmentId);

    /**
     * 删除部门实体
     *
     * @param departmentId 部门id
     */
    void deleteDepartment(Long departmentId);


     /**
      * 检查名称是否存在
      *
      * @param name 名称
      * @param excludeId 排除的id
      * @return 如果名称已经存在则返回true，否则返回false
      */
    boolean checkNameExists(String name, Long excludeId);

     /**
      * 根据部门id，查询员工笔数
      *
      * @param departmentId 部门id
      * @return 员工笔数
      */
    int countOfEmployeesByDepartmentId(Long departmentId);

    /**
     * 根据部门id，查询员工响应列表
     *
     * @param departmentId 部门id
     * @return 员工响应列表
     */
    List<EmployeeQueryVO> queryEmployeesByDepartmentId(Long departmentId);

    /**
     * 根据部门id，查询员工实体列表
     *
     * @param departmentId 部门id
     * @return 员工实体列表
     */
    List<EmployeeEntity> getEmployeesByDepartmentId(Long departmentId);
}
